
_currenttarget = "";
_cursorTarget = cursortarget;
_itemsPlayer = items player;
_magazinesPlayer = magazines player;
_isVehicle = _cursorTarget isKindOf "AllVehicles";
_isMan = _cursorTarget isKindOf "Man";
_ownerID = _cursorTarget getVariable ["CharacterID","0"];
_isAlive = alive _cursorTarget;

while {true} do {
	while {alive player} do {
		_typeoftarget = typeof cursortarget;
		_targetdistance = player distance cursortarget;
		//hint "EW_debug_clientActionAliveCheckTrue";
		
//Looking @ Captive==========================================================================
		if ((captive cursortarget)&&(alive cursortarget)) then {
			_idd1 = player addAction ["<t color='#ffff00'>Capture Soldier</t>", "capture.sqf", [cursortarget]];
			while {true} do {
				_currenttarget = cursortarget;
				if (!(captive cursortarget)) exitwith {
					player removeAction _idd1;
				};
			sleep 1;
			};
		};	
//Looking @ Player==================================================================================================
/*
		if (isplayer cursortarget) then {
			//hint format["EW_debug_clientActionLook@Player %1 %2",_typeoftarget,_targetdistance];
			while {true} do {
				_currenttarget = cursortarget;
				//hint "EW_debug_clientActionLook_Looking@Player";
				if (!(isplayer _currenttarget)) exitwith {
					//hint "EW_debug_clientActionLook_LookingSTOPPED";
				};
				sleep 1;
			};
		};
*/
//==================================================================================================================


// Looking @ OPEN device=================================================================================================
		if ((_typeoftarget == "Land_Device_disassembled_F")&&(_targetdistance < 3)&&(alive cursortarget)) exitwith {
			//hint format["EW_debug_clientActionLook@deviceOpen %1, %2",_typeoftarget,_targetdistance];
				//_current_target = cursortarget;
				//_idd3 = player addaction ["<t color='#0033CC'>Close Device</t>", "ENG\close_device.sqf"];
				_idd3 = player addaction ["<t color='#ff1111'>Sabotage Device</t>", "ENG\destroy_device.sqf"];
			while {true} do {
				_currenttypeoftarget = typeof cursortarget;
				_targetdistance = player distance cursortarget;
				//hint "EW_debug_clientActionLook_Looking@deviceOpen";
				if (!(_currenttypeoftarget == "Land_Device_disassembled_F")||(_targetdistance > 3)) exitwith {
					//hint "EW_debug_clientActionLook_LookingSTOPPED";
					player removeaction _idd3;
				};
				sleep 1;
			};
		};	
// ==================================================================================================================		

// Looking @ CLOSED Device=================================================================================================
		if ((_typeoftarget == "Land_Device_assembled_F")&&(_targetdistance < 3)) exitwith {
			//hint format["EW_debug_clientActionLook@deviceClosed %1, %2",_typeoftarget,_targetdistance];
				//_current_target = cursortarget;
				_idd3 = player addaction ["<t color='#ff1111'>Open Device</t>", "ENG\open_device.sqf"];
			while {true} do {
				_currenttypeoftarget = typeof cursortarget;
				_targetdistance = player distance cursortarget;
				//hint "EW_debug_clientActionLook_Looking@deviceOpen";
				if (!(_currenttypeoftarget == "Land_Device_assembled_F")||(_targetdistance > 3)) exitwith {
					//hint "EW_debug_clientActionLook_LookingSTOPPED";
					player removeaction _idd3;
				};
				sleep 1;
			};
		};		
//	======================================================================================================


	sleep 0.5;
	};
sleep 1;	
waituntil {alive player};
};